import validator from '../index.js';
// import { translateByCode } from '@/lib/getTransData';
export class CreateRegisterInput_Rules {
  constructor() {
    this.name = [
      { required: true, message: '机构名称不能为空', trigger: 'blur' }
    ];
    this.shortName = [
      { required: true, message: '机构简称不能为空', trigger: 'blur' }
    ];
    this.teamName = [
      { required: true, message: '参赛机构名称不能为空', trigger: 'blur' }
    ];
    this.teamShortName = [
      { required: true, message: '参赛机构简称不能为空', trigger: 'blur' }
    ];
    this.contactPerson = [
      { required: true, message: '联系人不能为空', trigger: 'blur' }
    ];
    this.delegationTypeCode = [
      { required: true, message: '机构类型不能为空', trigger: 'change' }
    ];
    this.phoneNumber = [
      { required: true, message: '手机号码不能为空', trigger: 'blur' },
      {
        validator(rule, value, callback) {
          callback(validator.checkPhone(value, '手机号码格式错误'));
        },
        trigger: 'blur'
      }
    ];
    this.addressData = [
      validator.required('请选择省市区')
    ];
  }
}
// 团体主页——信息校验
export class CreateDelegationInput_Rule extends CreateRegisterInput_Rules {
  constructor() {
    super();
    this.name = [
      { required: true, message: '机构名称不能为空', trigger: 'blur' }
    ];
    this.shortName = [
      { required: true, message: '机构简称不能为空', trigger: 'blur' }
    ];
    this.teamName = [
      { required: true, message: '参赛机构名称不能为空', trigger: 'blur' }
    ];
    this.teamShortName = [
      { required: true, message: '参赛机构简称不能为空', trigger: 'blur' }
    ];
    this.delegationTypeCode = [
      { required: true, message: '机构类型不能为空', trigger: 'change' }
    ];
    this.contactPerson = [
      { required: true, message: '联系人不能为空', trigger: 'blur' }
    ];
  }
}
// 账号设置
export class AccountSetting_Rules {
  constructor() {
    this.phoneNumber = [
      { required: true, message: '请输入新的手机号码', trigger: 'blur' },
      {
        validator(rule, value, callback) {
          callback(validator.checkPhone(value, '手机号码格式错误'));
        },
        trigger: 'blur'
      }
    ];
    this.code = [
      {
        required: true,
        message: '验证码不能为空',
        trigger: 'blur'
      },
      {
        min: 6,
        max: 6,
        trigger: 'blur'
      }
    ];
  }
}
// 修改密码
export class ModifyPasswordVO_Rules {
  constructor() {
    this.oldPassword = [
      { required: true, message: '原密码不能为空', trigger: 'blur' }
    ];
    this.password = [
      { required: true, message: '新密码不能为空', trigger: 'blur' },
      {
        validator(rule, value, callback) {
          callback(validator.checkPwd(value, '新密码格式不正确'));
        },
        trigger: 'blur'
      }
    ];
    this.rePassword = [
      { required: true, message: '确认密码不能为空', trigger: 'blur' },
      {
        validator(rule, value, callback) {
          callback(validator.checkPwd(value, '确认密码格式不正确'));
        },
        trigger: 'blur'
      }
    ];
  }
}
export class ModifyWeChatVO_Rules {
  constructor() {
    this.number = [
      { required: true, message: '微信号码不能为空', trigger: 'blur' }
    ];
  }
}

// 个人信息表单验证规则
export class PersonalUserInfoVO_Rules {
  constructor() {
    this.imagePath = [
      { required: true, message: '请上传个人照片', trigger: 'blur' }
    ];
    this.name = [
      { required: true, message: '请输入姓名', trigger: 'blur' }
    ];
    this.nationality = [
      { required: true, message: '请输入国籍', trigger: 'blur' }
    ];
    this.national = [
      { required: true, message: '请选择民族', trigger: 'change' }
    ];
    this.idCardTypeCode = [
      { required: true, message: '请选择证件类型', trigger: 'change' }
    ];
    this.idCardNumber = [
      { required: true, message: '请输入证件号码', trigger: 'blur' }
    ];
    this.genderCode = [
      { required: true, message: '请选择性别', trigger: 'blur' }
    ];
    this.birthDate = [
      { required: true, message: '请选择出生日期', trigger: 'change' }
    ];
    this.phoneNumber = [
      { required: true, message: '请输入联系人手机号', trigger: 'change' },
      {
        validator(rule, value, callback) {
          callback(validator.checkPhone(value, '手机号码格式错误'));
        },
        trigger: 'blur'
      }
    ];
    this.emergencyContactPhoneNumber = [
      {
        validator(rule, value, callback) {
          callback(validator.checkPhone(value, '手机号码格式错误'));
        },
        trigger: 'blur'
      }
    ];
    this.provinceCode = [
      { required: true, message: '请选择所在地区', trigger: 'change' }
    ];
    this.idCardImage = [
      { required: true, message: '请上传证件照正面', trigger: 'blur' }
    ];
    this.idCardBackImage = [
      { required: true, message: '请上传证件照反面', trigger: 'blur' }
    ];
    this.address = [
      { required: true, message: '请输入详细地址', trigger: 'blur' }
    ];
    this.registerTags = [
      { required: true, message: '请选择身份标签', trigger: 'blur' }
    ];
  }
}

// 团体信息表单验证规则
export class TeamUserInfoVO_Rules {
  constructor() {
    this.imagePath = [
      { required: true, message: '请上传照片', trigger: 'blur' }
    ];
    this.name = [
      { required: true, message: '请输入代表队名称', trigger: 'blur' }
    ];
    this.shortName = [
      { required: true, message: '请输入代表队简称', trigger: 'blur' }
    ];
    this.delegationTypeCode = [
      { required: true, message: '请选择代表队类型', trigger: 'change' }
    ];
    this.provinceCode = [
      { required: true, message: '请选择所在地区', trigger: 'change' }
    ];
    this.address = [
      { required: true, message: '请输入详细地址', trigger: 'blur' }
    ];
    this.contactPerson = [
      { required: true, message: '请输入联系人姓名', trigger: 'blur' }
    ];
    this.phoneNumber = [
      { required: true, message: '请输入联系人手机号', trigger: 'change' },
      {
        validator(rule, value, callback) {
          callback(validator.checkPhone(value, '手机号码格式错误'));
        },
        trigger: 'blur'
      }
    ];
  }
}

// 个人信息表单验证规则-培训
export class PersonalUserInfoForTrainVO_Rules {
  constructor() {
    this.imagePath = [
      { required: true, message: '请上传个人照片', trigger: 'blur' }
    ];
    this.name = [
      { required: true, message: '请输入姓名', trigger: 'blur' }
    ];
    this.genderCode = [
      { required: true, message: '请选择性别', trigger: 'blur' }
    ];
    this.nationality = [
      { required: true, message: '请输入国籍', trigger: 'blur' }
    ];
    this.national = [
      { required: true, message: '请选择民族', trigger: 'change' }
    ];
    this.birthDate = [
      { required: true, message: '请选择出生日期', trigger: 'change' }
    ];
    this.idCardTypeCode = [
      { required: true, message: '请选择证件类型', trigger: 'change' }
    ];
    this.phoneNumber = [
      { required: true, message: '请输入联系人手机号', trigger: 'change' },
      {
        validator(rule, value, callback) {
          callback(validator.checkPhone(value, '手机号码格式错误'));
        },
        trigger: 'blur'
      }
    ];
    this.provinceCode = [validator.required('请选择所在地区', 'onChange')];
    this.address = [validator.required('请输入详细地址', 'onChange')];
    this.idCardImage = [
      { required: true, message: '请上传证件照正面', trigger: 'blur' }
    ];
    this.idCardBackImage = [
      { required: true, message: '请上传证件照反面', trigger: 'blur' }
    ];
  }
}
